function [seismic_data,SI,Sx,Sy,Rx,Ry,Tn,nch]= readsegyfile(filename)
%input： filename: 文件名
%output:
%    seismic_data ;//地震数据
%    SI ;//采样点数 
%    Sx,Sy ;//炮点xy坐标
%    Rx,Ry ;//检波点xy坐标
%    Tn ;//每一炮道数
%    nch ;//道集数
%email:2906310084@qq.com
%2020-6-21
fid=fopen(filename,'r','b'); 
fseek(fid,3220,'bof');  %读取采样点数
SI=fread(fid,1,'int16','b') ;
fseek(fid,3212,'bof');  %读取每一炮道数
Tn=fread(fid,1,'int16'); 
fseek(fid,0,'eof');
nch=(ftell(fid)-3600)/((240+SI*4)*Tn);%获取道集数
seismic_data=zeros(SI,Tn*nch);
fseek(fid,3672,'bof');
for i=1:nch
   for j=1:Tn 
         fseek(fid,3600+(j-1)*240+(j-1)*SI*4+72+(240+SI*4)*Tn*(i-1),'bof');
         Sx(i,j)=fread(fid,1,'int32');
         Sy(i,j)=fread(fid,1,'int32');
         Rx(i,j)=fread(fid,1,'int32');
         Ry(i,j)=fread(fid,1,'int32'); 
         fseek(fid,152,'cof');%240-72-16
         seismic=fread(fid,[1,SI],'float32'); 
         seismic_data(:,j+Tn*(i-1))=seismic'; 
   end
end
fclose(fid);
end